package edu.sctu.zcy.month201505.day20150522;

/**
 * Created by user24 on 2015/5/22.
 */
public class Stage extends Thread {

    public void run(){

        ArmyRunnable armyTaskOfSuiDynasty = new ArmyRunnable();
        ArmyRunnable armyTaskOfRevolt = new ArmyRunnable();

        Thread armyOfSuiDynasty = new Thread(armyTaskOfSuiDynasty,"隋军");
        Thread armyTaskRevolt = new Thread(armyTaskOfRevolt,"农民起义军");

        armyOfSuiDynasty.start();
        armyTaskRevolt.start();

        try {
            Thread.sleep(50);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        armyTaskOfSuiDynasty.keepRunning = false;
        armyTaskOfRevolt.keepRunning = false;

        try {
            armyTaskRevolt.join();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {

        new Stage().start();

    }
}
